package scope_fun

private data class Pt(var x: Int, var y: Int)

private fun logValidStartPosition(str: String, sub: String) {
    str.indexOf(sub).takeIf { it >= 0 }?.let {
        println("start position: $it")
    }
}

fun main(args: Array<String>) {
    val obj = Pt(0, 0)

    obj.run {
        // xxx
        x = 10
        y = 10
    }

    with(obj) {

    }

    run {

    }

    logValidStartPosition("https://www.baidu.com", "baidu")

}